﻿<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<link rel="stylesheet" type="text/css" href="../themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="../themes/icon.css">
	<link rel="stylesheet" type="text/css" href="../demo.css">
	<script type="text/javascript" src="../jquery.min.js"></script>
	<script type="text/javascript" src="../jquery.easyui.min.js"></script>
	<script type="text/javascript" src="../locale/easyui-lang-zh_CN.js"></script>
	<script type="text/javascript" src="../jquery.cookie.js"></script>
    <script type="text/javascript" src="../extend.js"></script>
    <script>
        var dataListCache = null;
        var dataCache = null;
		var appId = GetQueryString("moduleid");
		var regions = getRegion();
		var salesPoints =getSalesPoint();
		var employees = getEmployee();
        
		var salesInSP = [];
        
        var searchArg = [];

        window.onresize=calSize;
        
        $(document).ready(function(){
            initBase();
            setData();
            calSize();
		});
		function initBase(){
			$('#Status').combobox({data:customerStatusData});
			$('#SalesPointId').combogrid(getComboGridInfo('门店','Name',[[
                            {field:'AutoId',title:'ID',width:80},
                            {field:'Code',title:'代号',width:120},
                            {field:'Name',title:'名称',width:120,align:'right'},
                        ]],salesPoints));			
			$('#RegionId').combogrid(getComboGridInfo('区域','Name',[[
                            {field:'AutoId',title:'ID',width:80},
                            {field:'Code',title:'代号',width:120},
                            {field:'Name',title:'名称',width:120,align:'right'},
                        ]],regions));	
			$('#SalesId').combogrid(getComboGridInfo('业务员','Name',[[
				{field:'AutoId',title:'ID',width:80},
				{field:'Code',title:'代号',width:120},
				{field:'Name',title:'名称',width:120,align:'right'},
			]],[]));	
            $('#SecSalesId').combogrid(getComboGridInfo('导购','Name',[[
				{field:'AutoId',title:'ID',width:80},
				{field:'Code',title:'代号',width:120},
				{field:'Name',title:'名称',width:120,align:'right'},
			]],[]));	
            $('#DesignerId').combogrid(getComboGridInfo('家装设计师','Name',[[
				{field:'AutoId',title:'ID',width:80},
				{field:'Code',title:'代号',width:120},
				{field:'Name',title:'名称',width:120,align:'right'},
			]],[]));		
        }
		function pageChanging(pageNumber, pageSize) {
            showMask("查找中");
            $.get('../../api/customer/list', { Args: searchArg, Length: pageSize, Pos: (pageNumber-1) * pageSize }, function (data) {
                if (data.Result == 0) {
                    dataListCache = JSON.parse(data.Data);
                    $("#customerList").datagrid("loadData", dataListCache);
                    $("#customerList").datagrid('getPager').pagination({ total: data.Count, pageNumber: pageNumber, onSelectPage: pageChanging });
                } else {
                    $.messager.alert('提示', data.Message, 'error');
                }
                hideMask();
            }, 'json');
        }
        function setData() {
            pageChanging(1,10);
        }
        window.onresize=calSize;
        function calSize(){
            var height=window.parent.document.getElementById("mainFrame").clientHeight;
            var width=window.parent.document.getElementById("mainFrame").clientWidth;
            window.parent.document.getElementById(appId).height = height-32;
            $("#customerList").datagrid('resize',{height:height-76,width:width-15});
            $("#toolbar").panel({width:width-15});
            $("#editToolbar").panel({width:width-15});
            $("#editZone").panel('resize',{height:height-76,width:width-15});
        }
        
        function initVal(){
            $('#AutoId').val(dataCache.AutoId);
            $('#Flag').val(dataCache.Flag);
            $('#Site').val(dataCache.Site);
			$('#State').val(dataCache.State);
            $('#Code').textbox("setValue",dataCache.Code);
            $('#Name').textbox("setValue",dataCache.Name);
			$('#Tel').textbox("setValue",dataCache.Tel);
            $('#Address').textbox("setValue",dataCache.Address);
            $('#DeliveryAddress').textbox("setValue",dataCache.DeliveryAddress);
            if(dataCache.SalesPointId==0){
                 $('#SalesPointId').combogrid("setValue","");   
            }else{
                $('#SalesPointId').combogrid("setValue",dataCache.SalesPointId);
            }
            if(dataCache.SalesPointId==0){
                 $('#RegionId').combogrid("setValue","");   
            }else{
                $('#RegionId').combogrid("setValue",dataCache.RegionId);
            }
            $('#Status').combobox("setValue",dataCache.Status);
            $('#Note').textbox("setValue",dataCache.Note);
            $('#SalesId').combogrid("setValue",dataCache.SalesId);
            $('#SecSalesId').combogrid("setValue",dataCache.SecSalesId);
            $('#Receiveable').numberbox("setValue",dataCache.Receiveable);
            $('#Received').numberbox("setValue",dataCache.Received);
            $('#SalesBonus').numberbox("setValue",dataCache.SalesBonus);
            $('#DesignerBonus').numberbox("setValue",dataCache.DesignerBonus);
            $('#ServiceBonus').numberbox("setValue",dataCache.ServiceBonus);
            $('#DesignerId').combogrid("setValue",dataCache.DesignerId);
            $('#Source').combobox("setValue",dataCache.Source);
            
        }
        function createNewRecord(){
            dataCache = new Object();
            dataCache.Code = getAutoCode('SAM_CUSTOMER_SET');
			var profile = JSON.parse( $.cookie('profile'));
            dataCache.SalesId = profile.EmployeeId;
            dataCache.SalesPointId = profile.SalesPoint;
			dataCache.RegionId = profile.Region;
            initVal();
            $('#editContent').window('open');
        }
        function editRecord(rowIndex,rowData){
            dataCache = rowData;
            initVal();
            $('#editContent').window('open');
        }
        function submitChange(){
            if (dataCache == null) {
                $.messager.alert("错误", "无法获取被编辑的对象", "error");
                return;
            }
            showMask();
			var oldData = JSON.parse(JSON.stringify(dataCache));
            dataCache.Flag = $("#Flag").val();
			dataCache.State = $("#State").val();
            dataCache.Code=$("#Code").textbox("getValue");
            dataCache.Name=$("#Name").textbox("getValue");
			dataCache.Tel = $('#Tel').textbox("getValue");
			dataCache.Address = $('#Address').textbox("getValue");
			dataCache.DeliveryAddress = $('#DeliveryAddress').textbox("getValue");
			dataCache.RegionId = $('#RegionId').combogrid("getValue");
			dataCache.Status = $('#Status').combobox("getValue");
			dataCache.Note = $('#Note').textbox("getValue");
			dataCache.SalesId = $('#SalesId').combogrid("getValue");
            dataCache.SecSalesId = $('#SecSalesId').combogrid("getValue");
			dataCache.SalesPointId = $('#SalesPointId').combogrid("getValue");
            dataCache.DesignerId = $('#DesignerId').combogrid("getValue");
            dataCache.Source = $('#Source').combogrid("getValue");
            $.post("../../api/customer/set",dataCache,function(response){
                if(response.Result==0){
                    dataCache = JSON.parse(response.Data);
                    if(dataCache.Flag!=1){
                        for(var i=0;i<dataListCache.length;i++){
                            if(dataListCache[i].AutoId == dataCache.AutoId){
                                dataListCache.splice(i,1,dataCache);
								console.log('列表第'+i+'项被更新');
                                break;
                            }
                        }
                    }else{
						dataListCache.splice(0,0,dataCache);
						console.log('新项被追加到列表');
					}
                    $('#customerList').datagrid('loadData', dataListCache); 
                    $.messager.alert("信息","操作成功","info");
                    $('#customerList').datagrid('selectRecord', dataCache.AutoId); 
                    $('#editContent').window('close');
                }else{
                    hideMask();
                    $.messager.alert("错误",response.Message,"error");
					dataCache = oldData;
                }
            })
            .error(function(){
                hideMask();
                $.messager.alert("错误","系统内部错误","error");
				dataCache = oldData;
            })
            .complete(function() { 
                hideMask();
            });
        }
        function loadDataCache(rowIndex, rowData) {
            dataCache = rowData;
        }
        function cusStatusFormatter(value,row,index){
            if(value==1){
                return "潜在客户";
            }else if(value==2){
                return "普通客户";
            }
        }
        function dealFormatter(value,row,index){
            if(row.Receiveable>0||row.Received>0){
                return "成交";
            }else{
                return "未成交";
            }
        }
		function regionFormatter(value,row,index){
			return valToName(regions,value);
        }
		function salesPointFormatter(value,row,index){
			return valToName(salesPoints,value);
        }
		function salesFormatter(value,row,index){
			return valToName(employees,value);
        }
        function showSalesBonus() {
            dataCache = $('#customerList').datagrid('getSelected');
            if(dataCache!=null){
                addTab(19, "销售提成["+dataCache.Name+"]", "./salesbonus.html", "&cusid=" + dataCache.AutoId);
            }else{
                $.messager.alert("提示","请选中一条记录","info");
            }
        }
        function showDesignerBonus() {
            dataCache = $('#customerList').datagrid('getSelected');
            if(dataCache!=null){
                addTab(20, "设计返点["+dataCache.Name+"]", "./designerbonus.html", "&cusid=" + dataCache.AutoId);
            }else{
                $.messager.alert("提示","请选中一条记录","info");
            }
        }
		function showCustomerOther() {
            dataCache = $('#customerList').datagrid('getSelected');
            if(dataCache!=null){
                addTab(20, "其他费用["+dataCache.Name+"]", "./customerother.html", "&cusid=" + dataCache.AutoId);
            }else{
                $.messager.alert("提示","请选中一条记录","info");
            }
        }
        function showPay() {
            dataCache =  $('#customerList').datagrid('getSelected');
            if(dataCache!=null){
                addTab(21, "订单收款["+dataCache.Name+"]", "./pay.html", "&cusid=" + dataCache.AutoId);
            }else{
                $.messager.alert("提示","请选中一条记录","info");
            }  
        }
        function showServiceBonus() {
            dataCache =  $('#customerList').datagrid('getSelected');
            if(dataCache!=null){
                addTab(23, "安装费用["+dataCache.Name+"]", "./servicebonus.html", "&cusid=" + dataCache.AutoId);
            }else{
                $.messager.alert("提示","请选中一条记录","info");
            }
        }
		function showOrder(){
			dataCache =  $('#customerList').datagrid('getSelected');
            if(dataCache!=null){
                addTab(23, "销售订单["+dataCache.Name+"]", "./order.html", "&customerid=" + dataCache.AutoId);
            }else{
                $.messager.alert("提示","请选中一条记录","info");
            }
        }
        function showHistory() {
            dataCache = $('#customerList').datagrid('getSelected');
            if (dataCache != null) {
                addTab(23, "跟进记录[" + dataCache.Name + "]", "./customerhistory.html", "&customerid=" + dataCache.AutoId);
            } else {
                $.messager.alert("提示", "请选中一条记录", "info");
            }
        }
		function salesPointSelected(nv,ov){
			salesInSP = [];
            var salesSpWithVIP = getSalesVIP(employees);
			if(nv!=''){				
				var members = dataFetcher('../../api/salespoint/listemployees?spId='+nv);
				if(members!=null){
					for(var i=0;i<employees.length;i++){
						for(var j=0;j<members.length;j++){
							if(employees[i].AutoId == members[j].EmployeeId){
								salesInSP.push(employees[i]);
                                salesSpWithVIP.push(employees[i]);
							}
						}
					}
				}
			}
			$('#SalesId').combogrid(getComboGridInfo('业务员','Name',[[
				{field:'AutoId',title:'ID',width:80},
				{field:'Code',title:'代号',width:120},
				{field:'Name',title:'名称',width:80,align:'right'},
			]],salesSpWithVIP));	
            $('#SecSalesId').combogrid(getComboGridInfo('导购','Name',[[
				{field:'AutoId',title:'ID',width:80},
				{field:'Code',title:'代号',width:120},
				{field:'Name',title:'名称',width:80,align:'right'},
			]],salesInSP));	
            $('#DesignerId').combogrid(getComboGridInfo('家装设计师','Name',[[
				{field:'AutoId',title:'ID',width:80},
				{field:'Code',title:'代号',width:120},
				{field:'Name',title:'名称',width:80,align:'right'},
			]],getOutDesigner(employees)));
			for(var k=0;k<salesPoints.length;k++){
				if(salesPoints[k].AutoId==nv){
					$('#RegionId').combogrid('setValue',salesPoints[k].RegionId);
				}
			}
		}
		function selectRecord(rowIndex,rowData){
			dataCache = rowData;
		}
		function deleteRecord(){
			if (dataCache == null||dataCache.AutoId==0) {
                $.messager.alert("提示", "请先选中要删除的对象", "info");
                return;
            }
			$.messager.confirm('删除提示', '确定删除该记录?', function(r){
				if (r){
					showMask();
					$.post("../../api/customer/remove",dataCache,function(response){
						if(response.Result==0){
							for(var i=0;i<dataListCache.length;i++){
								if(dataListCache[i].AutoId == dataCache.AutoId){
									dataListCache.splice(i,1);
									break;
								}
							}					
							dataCache = null;
							$('#customerList').datagrid('loadData', dataListCache); 
							$.messager.alert("信息","操作成功","info");
						}else{
							$.messager.alert("错误",response.Message,"error");
						}
					})
					.error(function(){
						$.messager.alert("错误","系统内部错误","error");
					})
					.complete(function() { 
						hideMask();
					});	
				}
			});		
		}
    </script>
</head>
<body onload = "hideMask()">
    <script>showMask('正在载入数据');</script>
    <div id="toolbar" class="easyui-panel" style="padding:1px;">
        <a href="#" class="easyui-linkbutton" data-options="onClick:createNewRecord,iconCls:'icon-edit',plain:true">新建</a>
        <a href="#" class="easyui-linkbutton" data-options="onClick:deleteRecord, iconCls:'icon-remove',plain:true">删除</a>
        <a href="#" class="easyui-linkbutton" data-options="onClick:function(){$('#search').window('open')},iconCls:'icon-search',plain:true">搜索</a>
        <a href="#" class="easyui-linkbutton" data-options="onClick:function(){exportData('../../api/customer/export',searchArg) },iconCls:'icon-pencil',plain:true">导出</a>
        <a href="#" class="easyui-linkbutton" data-options="onClick:showSalesBonus, iconCls:'icon-more',plain:true">销售提成</a>
        <a href="#" class="easyui-linkbutton" data-options="onClick:showDesignerBonus, iconCls:'icon-more',plain:true">设计返点</a>
        <a href="#" class="easyui-linkbutton" data-options="onClick:showServiceBonus, iconCls:'icon-more',plain:true">安装费用</a>
        <a href="#" class="easyui-linkbutton" data-options="onClick:showPay, iconCls:'icon-more',plain:true">订单收款</a>
        <a href="#" class="easyui-linkbutton" data-options="onClick:showCustomerOther, iconCls:'icon-more',plain:true">其他费用</a>
        <a href="#" class="easyui-linkbutton" data-options="onClick:showOrder, iconCls:'icon-more',plain:true">相关订单</a>
        <a href="#" class="easyui-linkbutton" data-options="onClick:showHistory, iconCls:'icon-more',plain:true">跟进记录</a>
    </div>
    <div style="margin:2px"></div>
    <table id="customerList" class="easyui-datagrid"
        data-options="pagination:true,rownumbers: true,singleSelect:true,method:'get',onClickRow:selectRecord,onDblClickRow:editRecord,striped:true,idField:'AutoId'">
        <thead>
            <tr>
                <th data-options="field:'AutoId',hidden:true"></th>
                <th data-options="field:'Flag',hidden:true"></th>
                <th data-options="field:'State',hidden:true"></th>
                <th data-options="field:'Code',width:140,align:'right'">客户代号</th>
                <th data-options="field:'Name',width:120,align:'right'">客户名称</th>
                <th data-options="field:'Tel',width:120,align:'right'">联系电话</th>
                <th data-options="field:'Address',width:120,align:'right',hidden:true">地址</th>
                <th data-options="field:'DeliveryAddress',width:120,align:'right',hidden:true">送货地址</th>
                <th data-options="field:'Note',width:120,align:'right',hidden:true">备注</th>
                <th data-options="field:'vDeal',width:120,align:'right',formatter:dealFormatter">是否成交</th>
                <th data-options="field:'RegionId',width:120,align:'right',formatter:regionFormatter">所属区域</th>
                <th data-options="field:'Status',width:120,align:'right',formatter:cusStatusFormatter">客户状态</th>
                <th data-options="field:'SalesPointId',width:120,align:'right',formatter:salesPointFormatter">所属门店</th>
                <th data-options="field:'SalesId',width:120,align:'right',formatter:salesFormatter">所属业务员</th>
                <th data-options="field:'DesignerId',width:120,align:'right',formatter:salesFormatter">家装设计师</th>
                <th data-options="field:'Receiveable',width:120,align:'right',formatter:moneyFormatter">应收款</th>
                <th data-options="field:'Received',width:120,align:'right',formatter:moneyFormatter">已收款</th>
                <th data-options="field:'SalesBonus',width:120,align:'right',formatter:moneyFormatter">销售提成</th>
                <th data-options="field:'DesignerBonus',width:120,align:'right',formatter:moneyFormatter">设计提成</th>
                <th data-options="field:'ServiceBonus',width:120,align:'right',formatter:moneyFormatter">安装提成</th>
            </tr>
        </thead>
    </table>
    <div id="editContent" class="easyui-window" title="编辑框" data-options="noheader:true,maximized:true,modal:true,closed:true,iconCls:'icon-save',border:false" style="padding:5px 5px 0px 5px">
        <div class="easyui-panel" id="editToolbar" style="padding:1px;width:100%">
            <a href="#" class="easyui-linkbutton" data-options="onClick:submitChange,iconCls:'icon-save',plain:true">保存</a>
            <a href="#" class="easyui-linkbutton" data-options="onClick:initVal,iconCls:'icon-no',plain:true">取消</a>
            <a href="#" class="easyui-linkbutton" data-options="onClick:function(){$('#editContent').window('close');},iconCls:'icon-blank',plain:true">关闭</a>
        </div>
        <div style="margin:2px"></div>
        <div id="editZone" class="easyui-panel" style="padding:4px 4px 0px 4px" >
            <table>
                <tr>
                    <td><input class="easyui-textbox" id="Code"  style="width:300px" data-options="label:'客户代号:',required:true"></td>
                    <td>&nbsp;</td>
                    <td><input class="easyui-textbox" id="Name"  style="width:300px" data-options="label:'客户名称:',required:true"></td>
					<td>&nbsp;</td>
					<td><input class="easyui-textbox" id="Tel"  style="width:300px" data-options="label:'联系电话:',required:true"></td>
                </tr>
                <tr>
                    <td><input class="easyui-combogrid" id="SalesPointId"  style="width:300px" data-options="onChange: salesPointSelected,required:true"></td>
                    <td>&nbsp;</td>
                    <td><input class="easyui-combogrid" id="RegionId"  style="width:300px"data-options="required:true"></td>
					<td>&nbsp;</td>
					<td><input class="easyui-combobox" id="Status"  style="width:300px" data-options="label:'状态:',valueField: 'AutoId',textField: 'Name',required:true"></td>
                </tr>
                <tr>
                    <td><input class="easyui-combogrid" id="SecSalesId"  style="width:300px" data-options="required:true" ></td>
                    <td>&nbsp;</td>
                    <td><input class="easyui-combogrid" id="SalesId"  style="width:300px" ></td>
				 <td>&nbsp;</td>
                    <td><input class="easyui-combogrid" id="DesignerId"  style="width:300px" ></td>
                </tr>
                <tr>
                <tr>
                    <td><input class="easyui-numberbox" id="Received"  style="width:300px" data-options="label:'已收款:',editable:false,precision:2,groupSeparator:',',decimalSeparator:'.',prefix:'￥'" ></td>
                    <td>&nbsp;</td>
                    <td><input class="easyui-numberbox" id="SalesBonus"  style="width:300px" data-options="label:'销售提成:',editable:false,precision:2,groupSeparator:',',decimalSeparator:'.',prefix:'￥'" ></td>
					<td>&nbsp;</td>
					<td><input class="easyui-combobox" id="Source"  style="width:300px"  data-options="label:'来源:',valueField: 'AutoId',textField: 'Name',data:customerSourceData,required:true"></td>
				</tr>
                <tr>
                    <td><input class="easyui-numberbox" id="DesignerBonus"  style="width:300px" data-options="label:'设计提成:',editable:false,precision:2,groupSeparator:',',decimalSeparator:'.',prefix:'￥'" ></td>
                    <td>&nbsp;</td>
                    <td><input class="easyui-numberbox" id="ServiceBonus"  style="width:300px" data-options="label:'安装提成:',editable:false,precision:2,groupSeparator:',',decimalSeparator:'.',prefix:'￥'" ></td>
					<td>&nbsp;</td>
					<td><input class="easyui-numberbox" id="Receiveable"  style="width:300px" data-options="label:'应收款:',editable:false,precision:2,groupSeparator:',',decimalSeparator:'.',prefix:'￥'" ></td>
				</tr>
                <tr>
                    <td colspan=3><input class="easyui-textbox" id="Note"  style="width:700px" data-options="label:'备注:'"></td>
                </tr>
                <tr>
                    <td colspan=3><input class="easyui-textbox" id="Address"  style="width:700px" data-options="label:'联系地址:',required:true"></td>
                </tr>
                <tr>
                    <td colspan=3><input class="easyui-textbox" id="DeliveryAddress"  style="width:700px" data-options="label:'送货地址:',required:true"></td>
                </tr>
            </table>
            <div hidden>
                <p id="AutoId"></p>
                <p id="State"></p>
                <p id="Flag"></p>
                <p id="Site"></p>
            </div>
            <div id="search" class="easyui-window" title="搜索框" data-options="modal:true,closed:true,iconCls:'icon-save'" style="width:500px;height:400px;padding:10px;">
                <div style="margin-bottom:5px">
                    <input class="easyui-textbox" id="sch_Name" style="width:100%" data-options="label:'客户名称:'">
                </div>
                <div style="margin-bottom:5px">
                    <input class="easyui-textbox" id="sch_Tel" style="width:100%" data-options="label:'联系电话:'">
                </div>
                <div style="margin-bottom:5px">
                    <input class="easyui-combobox" id="sch_Region" style="width:100%" data-options="label:'区域:',valueField:'AutoId',textField:'Name',data:regions">
                </div>
                <div style="margin-bottom:5px">
                    <input class="easyui-combobox" id="sch_SalesPoint" style="width:100%" data-options="label:'门店:',valueField:'AutoId',textField:'Name',data:salesPoints">
                </div>
                <div style="margin-bottom:5px">
                    <input class="easyui-combobox" id="sch_Status" style="width:100%" data-options="label:'状态:',valueField:'AutoId',textField:'Name',data:customerStatusData">
                </div>
                <div style="margin-bottom:5px">
                    <input class="easyui-combobox" id="sch_Employee" style="width:100%" data-options="label:'业务员:',valueField:'AutoId',textField:'Name',data:employees">
                </div>
                 <div style="margin-bottom:5px">
                    <input class="easyui-combobox" id="sch_Designer" style="width:100%" data-options="label:'家装设计师:',valueField:'AutoId',textField:'Name',data:employees">
                </div>
                <div style="text-align:center;padding:5px 0">
                    <a href="javascript:void(0)" class="easyui-linkbutton" onclick="exeSearch()" style="width:80px">搜索</a>
                    <a href="javascript:void(0)" class="easyui-linkbutton" onclick="clearSearch()" style="width:80px">重置</a>
                </div>
                <script>
                function exeSearch() {
                    searchArg = [];
                    var restain1 = {'Key':'Name','Op':'Lk','Value':'%'+$('#sch_Name').textbox('getValue')+'%'};
                    var restain2 = {'Key':'Tel','Op':'Lk','Value':'%'+$('#sch_Tel').textbox('getValue')+'%'};
                    searchArg.push(restain1);
                    searchArg.push(restain2);
                    var sch_rg = $("#sch_Region").combobox("getValue");
                    if(sch_rg>0){
                        searchArg.push({'Key':'RegionId','Op':'Eq','Value':sch_rg});
                    }
                    var sch_sp = $("#sch_SalesPoint").combobox("getValue");
                    if(sch_sp>0){
                        searchArg.push({'Key':'SalesPointId','Op':'Eq','Value':sch_sp});
                    }
                    var sch_st = $("#sch_Status").combobox("getValue");
                    if(sch_st>0){
                        searchArg.push({'Key':'Status','Op':'Eq','Value':sch_st});
                    }
                    var sch_em = $("#sch_Employee").combobox("getValue");
                    if(sch_em>0){
                        searchArg.push({'Key':'EmployeeId','Op':'Eq','Value':sch_em});
                    }
                    var sch_ds = $("#sch_Designer").combobox("getValue");
                    if(sch_ds>0){
                        searchArg.push({'Key':'DesignerId','Op':'Eq','Value':sch_ds});
                    }
                    $('#search').window('close');
                    setData();
                }
                function clearSearch() {
                    $('#sch_Code').textbox('setValue',"");
                    $('#sch_Tel').textbox('setValue',"");
                    $("#sch_Region").combobox("setValue","");
                    $("#sch_SalesPoint").combobox("setValue","");
                    $("#sch_Status").combobox("setValue","");
                    $("#sch_Employee").combobox("setValue","");
                     $("#sch_Designer").combobox("setValue","");
                }
             </script>
            </div>
		</div>
	</div>
</body>
</html>